//
//  STUserInfoView.m
//  YiYueStore
//
//  Created by zhouzhouzhou on 2018/9/28.
//  Copyright © 2018年 YuYiLian. All rights reserved.
//

#import "STUserInfoView.h"
#import "CALayer+YYAdd.h"
#import "YLHomeOrderListModel.h"
@implementation STUserInfoView

-(id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    //加载用户信息
    if (self) {
        self.autoresizesSubviews = NO;
        STUserInfoView * userView =  [[NSBundle mainBundle] loadNibNamed:@"STUserInfoView"owner:self options:nil].lastObject;
        self = userView;
        self.frame = frame;
    }
    return self;
}

-(void)setUserInfoWithData:(id)userData{
    YLHomeOrderListModel * detailModel = userData;
    [Tools setLayerCutCircularWithView:self.userImg cornerRedii:30.0];
    
    self.backView.layer.cornerRadius = 5;
    [self.backView.layer setLayerShadow:[UIColor blackColor] offset:CGSizeMake(0, 3) radius:2];
    self.backView.layer.shadowOpacity = 0.3;
    
    [_userImg sd_setImageWithURL:[NSURL URLWithString:detailModel.userPath]];
    _nameLab.text = detailModel.userNickname;
    _sexImg.image = [detailModel.userGender intValue] == 1 ? IMAGENAMED(@"man_selected") : IMAGENAMED(@"girl_selected");
    _birthLab.text = detailModel.userLabel;
}

@end
